<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<tiles:insertDefinition name="layout">
	<tiles:putAttribute name="head">
		<script type="text/javascript">
			$(function() {
				$(".date").datepicker({
					dateFormat : "yy-mm-dd"
				});

				//Validform库的应用
				$("form").Validform({
					ajaxPost : true,
					customReset : true,
					tiptype : ValidUtils.siblingTip,
					callback : function(data) {
						helper.showMsg(data, {
							okHandler : function() {
								location.href = "listUser";
							}
						});
					}
				});
			});
		</script>
	</tiles:putAttribute>
	<tiles:putAttribute name="mainBody">
		<ul class="breadcrumb">
			<li><a href="listUser">用户列表</a> <span class="divider">/</span></li>
			<li class="active">创建用户</li>
		</ul>
		<form action="doCreateUser" method="post" class="form-horizontal">
			<fieldset>
				<legend>创建用户</legend>
				<div class="control-group">
					<label class="control-label">校区</label>
					<div class="controls">
						<select name="campus">
							<s:iterator value="campuses" var="campus">
								<option value="${campus.id}">${campus.name}</option>
							</s:iterator>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">部门</label>
					<div class="controls">
						<select name="departmentId">
							<s:iterator value="#departments" var="department">
								<option value="${department.id}">${department.name}</option>
							</s:iterator>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">
						登录名<span style="color: #F00">*</span>
					</label>
					<div class="controls">
						<input type="text" name="loginName" datatype="name" /> <span class="Validform_checktip"></span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">
						名称<span style="color: #F00">*</span>
					</label>
					<div class="controls">
						<input type="text" name="name" datatype="name" /> <span class="Validform_checktip"></span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">说明</label>
					<div class="controls">
						<input type="text" name="title" /> <span class="Validform_checktip"></span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">职称</label>
					<div class="controls">
						<s:iterator value="roles" var="role">
							<label class="checkbox inline">
								<input name="roleId" type="checkbox" value="${role.id}" />${role.name}
							</label>
						</s:iterator>
						<span class="Validform_checktip"></span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">工号</label>
					<div class="controls">
						<input type="text" name="no" /><span class="Validform_checktip"></span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">入职时间</label>
					<div class="controls">
						<input type="text" name="entryTime" class="date" /> <span class="Validform_checktip"></span>
					</div>
				</div>
			</fieldset>
			<div class="control-group">
				<div class="controls">
					<button class="btn btn-primary" type="submit">
						<i class="icon-ok"></i>提交
					</button>
				</div>
			</div>
		</form>
	</tiles:putAttribute>
</tiles:insertDefinition>